<html>
<head><meta charset="utf-8"><title>const alloc::Layout · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/const.20alloc.3A.3ALayout.html">const alloc::Layout</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="214346382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/const%20alloc%3A%3ALayout/near/214346382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Chris Denton <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/const.20alloc.3A.3ALayout.html#214346382">(Oct 23 2020 at 18:04)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/67521">#67521</a> Does anyone know what's blocking making at least some of these <code>const fn</code> stable? Both <code>size</code> and <code>align</code> are simple (<code>usize</code> and <code>NonZeroUsize</code>) fields and I don't think there's any reason to make them not <code>const</code> compatible in the future? And <code>padding_needed_for</code> is simply doing arithmetic that includes these values.</p>



<a name="214352295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/const%20alloc%3A%3ALayout/near/214352295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/const.20alloc.3A.3ALayout.html#214352295">(Oct 23 2020 at 18:54)</a>:</h4>
<p><span class="user-mention" data-user-id="260325">@Chris Denton</span> probably no one has made a PR - are you interested in doing it? ;)</p>



<a name="214352494"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/const%20alloc%3A%3ALayout/near/214352494" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Chris Denton <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/const.20alloc.3A.3ALayout.html#214352494">(Oct 23 2020 at 18:56)</a>:</h4>
<p>Sure. But I don't know what's involved. Is it as simple as removing the <code>rustc_const_unstable</code> attribute?</p>



<a name="214352698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/const%20alloc%3A%3ALayout/near/214352698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/const.20alloc.3A.3ALayout.html#214352698">(Oct 23 2020 at 18:57)</a>:</h4>
<p>yes, you need to make a stabilization pr: <a href="https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#stabilization-pr">https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#stabilization-pr</a></p>



<a name="214352777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/const%20alloc%3A%3ALayout/near/214352777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/const.20alloc.3A.3ALayout.html#214352777">(Oct 23 2020 at 18:58)</a>:</h4>
<p>most of those steps are not really relevant for libraries :/ I'm not sure if the library side of things is documented</p>



<a name="214352822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/const%20alloc%3A%3ALayout/near/214352822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/const.20alloc.3A.3ALayout.html#214352822">(Oct 23 2020 at 18:58)</a>:</h4>
<p><span class="user-group-mention" data-user-group-id="2645">@T-libs</span> do you know the procedure for this / are any of you interested in adding this to the dev-guide?</p>



<a name="214355254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/const%20alloc%3A%3ALayout/near/214355254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/const.20alloc.3A.3ALayout.html#214355254">(Oct 23 2020 at 19:21)</a>:</h4>
<p>Generally for libs stuff it's pretty easy, just make a PR (<a href="https://github.com/rust-lang/rust/pull/75132">example</a>) and mark it <code>T-libs</code> and <code>needs-fcp</code>.</p>



<a name="214357372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/const%20alloc%3A%3ALayout/near/214357372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Chris Denton <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/const.20alloc.3A.3ALayout.html#214357372">(Oct 23 2020 at 19:43)</a>:</h4>
<p>I notice that some methods in <code>Layout</code> have an attribute like:</p>
<div class="codehilite"><pre><span></span><code>#[rustc_const_stable(feature = &quot;alloc_layout&quot;, since = &quot;1.28.0&quot;)]
</code></pre></div>


<p>Is this something I should be using?</p>



<a name="214360523"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/const%20alloc%3A%3ALayout/near/214360523" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/const.20alloc.3A.3ALayout.html#214360523">(Oct 23 2020 at 20:12)</a>:</h4>
<p><span class="user-mention" data-user-id="260325">@Chris Denton</span> In your own code - no. That's an internal standard library attribute to control whether a function can be used as <code>const</code> on the stable channel</p>



<a name="214360555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/const%20alloc%3A%3ALayout/near/214360555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/const.20alloc.3A.3ALayout.html#214360555">(Oct 23 2020 at 20:13)</a>:</h4>
<p>oops, I didn't see that this was in a thread</p>



<a name="214360663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/const%20alloc%3A%3ALayout/near/214360663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/const.20alloc.3A.3ALayout.html#214360663">(Oct 23 2020 at 20:14)</a>:</h4>
<p>if you're stabilizing something as available as const on the stable channel, then yes</p>



<a name="214361221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/const%20alloc%3A%3ALayout/near/214361221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Chris Denton <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/const.20alloc.3A.3ALayout.html#214361221">(Oct 23 2020 at 20:19)</a>:</h4>
<p>Thanks, I've done that now. I've put the version as <code>1.48</code>. Is that right? Or is too late for 1.48?</p>



<a name="214361291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/const%20alloc%3A%3ALayout/near/214361291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/const.20alloc.3A.3ALayout.html#214361291">(Oct 23 2020 at 20:20)</a>:</h4>
<p>no, 1.48 will be stable in 4 weeks. You want 1.49: <a href="https://forge.rust-lang.org/#current-release-versions">https://forge.rust-lang.org/#current-release-versions</a></p>



<a name="214370346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/const%20alloc%3A%3ALayout/near/214370346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/const.20alloc.3A.3ALayout.html#214370346">(Oct 23 2020 at 21:55)</a>:</h4>
<p>opened <a href="https://github.com/rust-lang/rustc-dev-guide/issues/932">https://github.com/rust-lang/rustc-dev-guide/issues/932</a> to document this better</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>